package com.polaris.live.common.mvvm.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.polaris.live.common.mvvm.ext.inflateBindingWithGeneric
import com.polaris.live.common.mvvm.viewmodel.BaseViewModel

/**
 * fragment封装的viewbinding
 *
 * @author Created by 半仙 on 2023/7/31/031 15:20
 */
abstract class BaseVmVbFragment<VM : BaseViewModel, VB : ViewBinding> : BaseVmFragment<VM>() {

    override fun layoutId() = 0

    //该类绑定的 ViewBinding
    private lateinit var _binding: VB
    val mBinding: VB get() = _binding

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?,
    ): View? {
        _binding = inflateBindingWithGeneric(inflater, container, false)
        return _binding.root
    }
}
